package spring.j2024_11_14.dao;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import spring.j2024_11_14.model.BookInfo;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Component
public class BookDao {

    public List<BookInfo> mockBookList() {   // mock 构造虚拟数据
        List<BookInfo> list  = new ArrayList<>();
        for (int i = 1; i <= 15; i++) {
            BookInfo book = new BookInfo() ;
            book.setId(i);
            book.setBookName("图书"+i);
            book.setAuthor("作者"+i);
            book.setPublisher("出版社"+i);
            book.setCount(i);
            book.setPrice(new BigDecimal(new Random().nextInt(100)));
            book.setStatus(i%4==0?1:2);
            list.add(book);
        }
        return list ;
    }
}
